<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Services\CustomService;
use Illuminate\Http\Request;
use Tymon\JWTAuth\Facades\JWTAuth;

class CustomController extends Controller
{
    private $customService;
    public function __construct(CustomService $customService)
    {
        $this->customService = $customService;
    }
    public function customList(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->getList($params);
        return $this->responseSuccess($result);
    }

    public function customInfo(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->getInfo($params);
        return $this->responseSuccess($result);
    }

    public function insertCustom(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->insertCustom($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("更新失败，请重试！");
    }

    public function updateCustom(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->updateCustom($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("更新失败，请重试！");
    }

    public function updateCustomState(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->updateCustomState($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("更新失败，请重试！");
    }

    public function updateCustomStatus(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->updateCustomStatus($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("更新失败，请重试！");
    }

    public function updateCustomIntention(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->updateCustomIntention($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("更新失败，请重试！");
    }

    public function updateCustomDrow(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->updateCustomDrow($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("更新失败，请重试！");
    }

    public function customDel(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->customDel($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("删除失败，请重试！");
    }

    public function getFollows(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->getFollows($params);
        return $this->responseSuccess($result);
    }

    public function getCustomReport(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->getCustomReport($params);
        return $this->responseSuccess($result);
    }

    public function insertFollow(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->insertFollow($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("添加失败，请重试！");
    }

    public function exportLog()
    {
        $result = $this->customService->exportLog();
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("添加失败，请重试！");
    }

    public function exportTemplate(Request $request)
    {
        $params = $request->input();
        $result = $this->customService->exportTemplate($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError("添加失败，请重试！");
    }
}
